package com.yidu.t279;

import com.yidu.t279.dao.PlaceMoneyMapper;
import com.yidu.t279.pojo.PlaceMoney;
import com.yidu.t279.pojo.PlaceMoneyPlace;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

/**
 * @author ：liandyao
 * @description：TODO
 * @date ：2020/4/24 14:01
 */
public class PlaceMoneyTest {

    @Test
    public void findAll(){
        SqlSession session = App.getSqlSession();

        PlaceMoneyMapper moneyMapper = session.getMapper(PlaceMoneyMapper.class);
        PlaceMoney placeMoney = moneyMapper.findById(6);

        //System.out.println(placeMoney.getMoney());
        //System.out.println(placeMoney.getPlace().getName());

        System.out.println(placeMoney.toString());

        session.close();
    }

    @Test
    public void findAll2(){
        SqlSession session = App.getSqlSession();

        PlaceMoneyMapper moneyMapper = session.getMapper(PlaceMoneyMapper.class);
        List<PlaceMoneyPlace> list = moneyMapper.findAll2();

        for(PlaceMoneyPlace place:list){
            System.out.println(place.toString());
        }

        session.close();
    }
}
